class Solution(object):
    def findPoisonedDuration(self, timeSeries, duration):
        """
        :type timeSeries: List[int]
        :type duration: int
        :rtype: int
        """
        total = 0
        n = len(timeSeries)
        for i in range(n - 1):
            total += min(duration, timeSeries[i + 1] - timeSeries[i])
        total += duration
        return total